package com.geng.demo.controller;

import com.geng.demo.domain.pojo.hdata.HLodge;
import com.geng.demo.mybatisplus.hdata.HLodgeMapper;
import com.geng.demo.service.HDataService;
import com.geng.demo.util.ParamUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/hdata")
public class HDataController {

    @Autowired
    HLodgeMapper hLodgeMapper;

    @Autowired
    HDataService hDataService;

    @PostMapping(value = "/select")
    public Map<String, Object> genggengtest(@RequestBody Map param) throws Exception {
        List<HLodge> hLodges = hLodgeMapper.selectAll();
        Map<String, Object> successMap = ParamUtil.returnSuccessMap();
        successMap.put("data", hLodges);
        return successMap;
    }

    @PostMapping(value = "/parseExcel")
    public Map<String, Object> parseExcel(@RequestBody Map param) {
        hDataService.parseExcel();
        Map<String, Object> successMap = ParamUtil.returnSuccessMap();
        return successMap;
    }


}
